<template>
  <a-card title="流程历史跟踪">
    <a-table
      size="middle"
      bordered
      row-key="id"
      :columns="columns"
      :data-source="dataSource"
    >
    </a-table>
  </a-card>
</template>

<script>
import { historicFlow } from '@/api/task'
export default {
  name: 'historyProcessCard',
  props: {
    taskData: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      dataSource: [],
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '名称',
          align: 'center',
          dataIndex: 'name'
        },
        {
          title: '流程实例ID',
          align: 'center',
          dataIndex: 'procInstId'
        },
        {
          title: '开始时间',
          align: 'center',
          dataIndex: 'startTime'
        },
        {
          title: '结束时间',
          align: 'center',
          dataIndex: 'endTime'
        },
        {
          title: '负责人',
          align: 'center',
          dataIndex: 'assignee'
        },
        {
          title: '处理结果',
          align: 'center',
          dataIndex: 'deleteReason'
        },
        {
          title: '处理意见',
          align: 'center',
          dataIndex: 'remarks'
        }
      ]
    }
  },
  mounted() {
    const that = this
    historicFlow({ id: this.taskData.processInstanceId }).then(function(res) {
      if (res.success) {
        that.dataSource = res.result
      } else {
        that.$message.error(res.message)
      }
    })
  },
  methods: {

  }
}
</script>
